package com.forever7776.life.core.service.impl.sys;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.forever7776.life.core.common.vo.SysFileListVO;
import com.forever7776.life.core.common.vo.SysFileSearchVO;
import com.forever7776.life.core.entity.sys.SysFile;
import com.forever7776.life.core.mapper.sys.SysFileMapper;
import com.forever7776.life.core.service.sys.ISysFileService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 文件系统表 服务实现类
 * </p>
 *
 * @author kz
 * @since 2018-01-18
 */
@Service
public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> implements ISysFileService {

    @Autowired
    private SysFileMapper sysFileMapper;

    /**
     * 查询文件列表
     *
     * @param page
     * @param searchVO
     * @return
     */
    @Override
    public Page<SysFileListVO> selectUsersByCondition(Page<SysFileListVO> page, SysFileSearchVO searchVO) {
        List<SysFileListVO> list =sysFileMapper.selectSysFileList(page,searchVO);
        page.setRecords(list);
        return page;
    }

    /**
     * 查询文件总数
     *
     * @return
     */
    @Override
    public Integer selectCount() {
        return sysFileMapper.selectCount(new EntityWrapper<>());
    }
}
